/*
 * @Author: jiu yin
 * @Date: 2023-11-13 14:07:45
 * @LastEditTime: 2023-12-06 15:10:09
 * @LastEditors: jiu yin zhen jing
 * @FilePath: \web-admin\src\comment\platform\index.tsx
 * jiu
 */
import React, { useState, useEffect } from "react";
import "./index.scss";
import { Input, Button } from "antd";
import { platform_arr } from "@/utils/enum";

function Platform(props: any) {
   //平台切换 查询 重置
   let {
      platform_active = (value: number) => {},
      inquire = (input_value: string) => {},
      reset = () => {},
   } = props;
   //搜索
   let searchInit = { keyword: "" };
   const [search, setSearch] = useState(searchInit);

   //点击平台
   let [active_index, set_active_index] = useState(0);
   const platform_item = (item: any, index: number) => {
      set_active_index(index);
      platform_active(item.value);
   };

   return (
      <div className="platform">
         <div className="left flex">
            <div className="text">上传平台</div>
            <ul className="flex">
               {platform_arr.map((item, index) => {
                  return (
                     <li
                        key={index}
                        onClick={() => {
                           setSearch(searchInit), platform_item(item, index);
                        }}
                        className={`${active_index == index ? "blue" : ""}`}>
                        <div className="border_bottom">
                           <i> {item.icon}</i>
                           <span>{item.label}</span>
                        </div>
                     </li>
                  );
               })}
            </ul>
         </div>
         {/* <div className="search">
            <Input
               placeholder="模糊搜索关键字"
               className="input"
               value={search.keyword}
               onChange={e => setSearch({ ...search, keyword: e.target.value })}
            />
            <Button
               type="primary"
               className="ml_10"
               onClick={() => {
                  inquire(search.keyword);
               }}>
               查询
            </Button>
            <Button
               className="ml_10"
               onClick={() => {
                  setSearch(searchInit), reset();
               }}>
               重置
            </Button>
         </div> */}
      </div>
   );
}
export default Platform;
